import request from "../../utils/request.ts";
import { message } from "antd";
import type { AxiosResponse } from "axios";
// 获取首页
export const getScheduling = async (): Promise<any> => {
  try {
    const res: AxiosResponse<any, any> = await request.get(
      "/infomationcenter/dayline"
    );
    if (res.data.code === 1) {
      return res.data;
    }
    message.error(res.data.msg);
  } catch (err) {
    message.error("获取首页失败");
    throw err;
  }
};
// 获取获取医院公告
export const getBulletin = async (): Promise<any> => {
  try {
    const res: AxiosResponse<any, any> = await request.get(
      "/infomationcenter/news"
    );
    if (res.data.code === 1) {
      return res.data;
    }
    message.error(res.data.msg);
  } catch (err) {
    message.error("获取医院公告失败");
    throw err;
  }
};
// 获取 当班主任 && 科室排队情况
// /infomationcenter/departmentline
export const getCircumstance = async (): Promise<any> => {
  try {
    const res: AxiosResponse<any, any> = await request.get(
      "/infomationcenter/departmentline"
    );
    if (res.data.code === 1) {
      return res.data;
    }
    message.error(res.data.msg);
  } catch (err) {
    message.error("获取当班主任 && 科室排队情况失败");
    throw err;
  }
};
